package com.dayaokeji.rhythmschoolstudent.client.home.adapter

import android.view.View
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.dayaokeji.rhythmschoolstudent.R
import com.dayaokeji.server_api.domain.Meeting

/**
 *********************************************************************
 **  Created by Zeno on 2018/7/27
 *********************************************************************
 **  version 1.0
 *********************************************************************
 **  Copyright (C) dayaokeji.com 2018 -- 2020 All rights reserved.
 *********************************************************************
 **
 *********************************************************************
 */
class JoinMeetingListAdapter : BaseQuickAdapter<Meeting,BaseViewHolder>(R.layout.item_join_meeting_list,null) {
    override fun convert(helper: BaseViewHolder?, item: Meeting?) {
        helper?.addOnClickListener(R.id.tv_join_course)
        helper?.setText(R.id.tv_title,item?.name)
        helper?.setText(R.id.tv_address,mContext.getString(R.string.address,item?.roomName))
        helper?.setText(R.id.tv_date,item?.actStartTime)
        val tvHost = helper?.getView<TextView>(R.id.tv_host)
        item?.let {
            if (it.facilitatorInfoList?.isNotEmpty()!!) {
                tvHost?.text = it.facilitatorInfoList[0].userName
            }else{
                tvHost?.visibility = View.GONE
            }
        }
    }
}